package com.gw.smscheck.service.sys.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gw.smscheck.dao.sys.LogMapper;
import com.gw.smscheck.entity.sys.Log;
import com.gw.smscheck.service.sys.LogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LogServiceImpl implements LogService {
	@Autowired
	private LogMapper logMapper;

    /**
     * 添加操作日志
	 * @param log
     * @return
     */
	@Override
	public Integer add(Log log) {
		return logMapper.add(log);
	}
	@Override
	public List<Log> findAll() {
		return logMapper.findAll();
	}

	/**
	 * 分页查询
	 * @param dto
	 * @return
	 */
	@Override
	public PageInfo<Log> pageSelect(Log dto) {
		PageHelper.startPage(dto.getPage(), dto.getRows(), "request_time desc");// 排序
		List<Log> resultList = logMapper.pageSelect(dto);
		PageInfo<Log> pageInfo = new PageInfo<>(resultList);
		return pageInfo;
	}
	@Override
	public Log findById(Integer dto) {
		return logMapper.findById(dto);
	}
	@Override
	public Integer update(Log log) {
		return logMapper.update(log);
	}
	@Override
	public Integer delByIds(String[] ids) {
		return logMapper.delByIds(ids);
	}
}

